<?php
header('Content-type:application/json');
$arr=[];
require('init.php');
$sql="SELECT*FROM message";
$result=mysqli_query($conn,$sql);
while(true){
    $row=mysqli_fetch_assoc($result);
    if(!$row){
        break;
    }
    $arr[]=$row;
}
echo json_encode($arr);
